package com.open.capacity.db.feign;

import com.open.capacity.common.constant.ServiceNameConstant;
import com.open.capacity.common.feign.FeignExceptionConfig;
import com.open.capacity.common.model.DB;
import com.open.capacity.common.model.DBTable;
import com.open.capacity.common.model.TableField;
import com.open.capacity.db.feign.impl.FireBirdFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = ServiceNameConstant.FIREBIRD, configuration = FeignExceptionConfig.class, fallbackFactory = FireBirdFeignClientFallback.class, decode404 = true)
public interface FireBirdFeignClient {

    @PostMapping("/fireBird/getTables")
    List<String> getTables(@RequestBody DB db);

    @PostMapping("/fireBird/getTableFields")
    List<TableField> getTableFields(@RequestParam("map") Map map);
}
